/////////////////////////
// 	DDMenu.h	:	v0010
//	Written by 	:	Li	Haijun
//	Compiler	:	Microsoft Visual C++ 4.0
//	v0010		:	Nov.07.1996
/////////////////////////

/////////////////////////////////////////////////////////////////////////////
// CDDMenu class
#ifndef __DDMENU_H__
#define __DDMENU_H__

#include	"ddapi.h"
#include	"Marco.h"
#include	"DDButton.h"

class	CDDMenu
{
//data member
private:
	//the surface that this menu's bitmap is load on
	CDDSurface	m_BitmapSurface;
// Attributes
private:
	int		m_nFileNameId; // name of this DIB file name
	SIZE	m_szBitmap;		// the size of this bitmap
	int		m_nID;			// the ID of this menu, it is defined in marco.h head file

	BOOL	m_bText ;	// to flag whether have some letters on this menu
	int		m_dTextSer ;	// for a menu to record the current id of the string when you want to show a string from a multiple line string in a menu
	char	m_sText[1024] ;	// this is the string belong to this menu
	int		m_dTextX, m_dTextY ;	// to store the point that the letters should be placed
	int		m_nTextColumn, m_nTextRow ;	// to store the column and row that the text should be array

	BOOL	m_bTitle ;	// to flag whether have a titil string in this menu
	char	m_sTitle[256] ;	// for store the title of this menu
	int		m_dTitleX, m_dTitleY ;	// to strore the point that the title should be placed
public:
	int		m_dwX, m_dwY;	// the position of this bitmap to blit on
	CDDButtonUnit	m_MenuButtonUnit;	//to store all buttons belong to this menu  
//member function
public:
	// contructor
	CDDMenu();
	// discontructor
	~CDDMenu();
	// initializes and load background bitmap
	BOOL	PreLoad(int FilenameId, int posX = -1, int posY = -1);
	// to set the indentification of this menu
	void	SetID( int nID ){ m_nID = nID; }
	// to get the id of this menu
	int		GetID( void ){ return m_nID ; }
	// to set the show position of the back ground bitmap of this menu
	void SetPosition(int x, int y);
	// to set the size of back ground bitmap of this menu
	void SetSize(int Width, int Height);
	// to set the serial number of the current string
	void SetStringSer(int ser){ m_dTextSer = ser ; }
	// to set the column of the string of the menu
	void SetStringColumn(int column){ m_nTextColumn = column ; }
	// to get the serial number of the current string
	int	 GetStringSer( void ){ return m_dTextSer ; }
	// to set the string position
	void SetStringPos(int x, int y){ m_dTextX=x; m_dTextY=y; }
	// to set the string of this menu
	void SetString( LPCTSTR text ) ;
	// to set the title of this menu
	void SetTitle( LPCTSTR title ) ;
	// to release the background bitmap and command unit
	void	Release(void);
	// to blit the text of this menu
	BOOL	BlitString(void) ;
	// to blit the background picture and the command unit of this menu to the back buffer
	BOOL	Blit(void);
	// to blit only the background picture to the back buffer
	BOOL	BlitBackGround(void);
	// to updata the background( of this menu ) picture to the front buffer
	void	Update(void);
	// to show this menu
	void	Show( );		// to show the menu (menu bitmap and all button bitmaps)
	///////////////////////////////////////////////////////////////
	//		this member function only use in main menu
	// to restore the main back-ground that been modified by this menu
	////////////////////////////////////////////////////////////////
	void	RestoreBackGround();
};
///////////////////////////////////
#endif